package com.ruoyi.service.account.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.service.account.entity.CompanyAccountDetailEntity;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 公司账户变动明细 Mapper 接口
 * </p>
 *
 * @author Zane
 * @since 2025-10-19
 */
public interface CompanyAccountDetailMapper extends BaseMapper<CompanyAccountDetailEntity> {

  @Select("SELECT SUM(change_amount) AS totalAmount FROM t_company_account_detail"
      + " WHERE change_type = #{changeType} AND (create_time BETWEEN #{begin} AND #{end})")
  BigDecimal getPreDepositInDays(@Param("begin") LocalDateTime begin,
      @Param("end") LocalDateTime end, @Param("changeType") String changeType);
  @Select("SELECT SUM(change_amount) AS totalAmount FROM t_company_account_detail"
      + " WHERE change_type = #{changeType}")
  BigDecimal getPlatformFlows(@Param("changeType") String changeType);
}
